import request from '@/utils/request'

export default{

  // 取消发布课程
  handleStopPublish(id) {
    return request({
      url: `/admin/edu/course/stopPublish/${id}`,
      method: 'PUT'
    })
  },

  // 改变课程的发布状态(发布课程)
  handlePublish(id) {
    return request({
      url: `/admin/edu/course/publish/${id}`,
      method: 'PUT'
    })
  },

  // 查询发布课程信息
  getCoursePublish(id) {
    return request({
      url: `/admin/edu/course/getCoursePublishVo/${id}`,
      method: 'GET'
    })
  },
  // 删除课程
  removeById(id) {
    return request({
      url: `/admin/edu/course/deleteById/${id}`,
      method: 'delete'
    })
  },
  // 更新课程信息
  updateById(courseInfo, courseId) {
    return request({
      url: `/admin/edu/course/updateById/${courseId}`,
      method: 'PUT',
      data: courseInfo
    })
  },
  // 分页查询课程列表
  queryPage(pageNum, pageSize) {
    return request({
      url: `/admin/edu/course/queryPage/${pageNum}/${pageSize}`,
      method: 'GET'
    })
  },
  // 回显课程信息
  getCourseInfo(courseId) {
    return request({
      url: `/admin/edu/course/getCourseInfo/${courseId}`,
      method: 'GET'
    })
  },
  // 保存课程信息
  saveCourseInfo(courseInfo) {
    return request({
      url: '/admin/edu/course/saveCourseInfo',
      method: 'POST',
      data: courseInfo
    })
  }
}
